package com.mzy.olddate.demo.regular;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author Ives
 * * @date 2021/7/21
 */
public class RegularDemo {

  public static void main(String [] args){
//    boolean flag = aaa("999");
//    System.out.println(flag);
//    flag = aaa("asdasd");
//    System.out.println(flag);

    String str = "5";

    String str2 = "5";


    int i= Integer.parseInt(str)-Integer.parseInt(str2);
//    int i = str.compareTo(str2);
    System.out.println(i);
    if (i>0){
      System.out.println("str>str2" +"允许添加");
    }else {
      System.out.println("str<str2||str=str2" +"不允许添加");
    }



    String pattern = "[1-9]\\d*";

    Pattern r = Pattern.compile(pattern);
    Matcher m = r.matcher(str);
    System.out.println(m.matches());
  }



  public static boolean aaa(String a){
    boolean flag;

    if(!a.matches("^[0-9_]+$")){//正则表达式 【匹配是否为数字
      System.out.println("??"+!a.matches("^[0-9_]+$"));
      flag = false;
    }else{
      flag = true;
    }
    return flag;
  }

}
